package net.wofly.sale.exchange.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import net.wofly.sale.exchange.repository.CardExchangeRepository;
import net.wofly.sale.exchange.domain.CardExchange;
import net.wofly.sale.exchange.service.ICardExchangeService;

@Service("iCardExchangeService")
@Transactional
public class CardExchangeServiceImpl implements ICardExchangeService {

	@Autowired
	CardExchangeRepository cardExchangeRepository;

	@Override
	public CardExchange save(CardExchange entity) {
		return cardExchangeRepository.save(entity);
	}

	@Override
	public void delete(CardExchange entity) {
		cardExchangeRepository.delete(entity);
	}

	@Override
	public void delete(String key) {
		cardExchangeRepository.delete(key);
	}

	@Override
	public CardExchange findOne(String key) {
		return cardExchangeRepository.findOne(key);
	}

	@Override
	public List<CardExchange> save(List<CardExchange> entityList) {
		return (List<CardExchange>) cardExchangeRepository.save(entityList);
	}

	@Override
	public Page<CardExchange> findAll(Specification specification, Pageable pageable) {
		return cardExchangeRepository.findAll(specification, pageable);
	}
}
